<?php

/**
 * User form base class.
 *
 * @method User getObject() Returns the current form's model object
 *
 * @package    faceshop
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUserForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'uid'              => new sfWidgetFormInputHidden(),
      'email'            => new sfWidgetFormInputText(),
      'locale'           => new sfWidgetFormInputText(),
      'first_name'       => new sfWidgetFormInputText(),
      'last_name'        => new sfWidgetFormInputText(),
      'name'             => new sfWidgetFormInputText(),
      'third_party_id'   => new sfWidgetFormInputText(),
      'sponsoring_id'    => new sfWidgetFormInputText(),
      'is_auth'          => new sfWidgetFormInputCheckbox(),
      'is_super_admin'   => new sfWidgetFormInputCheckbox(),
      'is_test_account'  => new sfWidgetFormInputCheckbox(),
      'is_salesrep'      => new sfWidgetFormInputCheckbox(),
      'is_admin_updated' => new sfWidgetFormInputCheckbox(),
      'is_email_active'  => new sfWidgetFormInputCheckbox(),
      'rt_valid'         => new sfWidgetFormInputCheckbox(),
      'rt_updated_at'    => new sfWidgetFormDateTime(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'uid'              => new sfValidatorChoice(array('choices' => array($this->getObject()->get('uid')), 'empty_value' => $this->getObject()->get('uid'), 'required' => false)),
      'email'            => new sfValidatorString(array('max_length' => 255)),
      'locale'           => new sfValidatorString(array('max_length' => 7)),
      'first_name'       => new sfValidatorString(array('max_length' => 255)),
      'last_name'        => new sfValidatorString(array('max_length' => 255)),
      'name'             => new sfValidatorString(array('max_length' => 255)),
      'third_party_id'   => new sfValidatorString(array('max_length' => 255)),
      'sponsoring_id'    => new sfValidatorInteger(),
      'is_auth'          => new sfValidatorBoolean(array('required' => false)),
      'is_super_admin'   => new sfValidatorBoolean(array('required' => false)),
      'is_test_account'  => new sfValidatorBoolean(array('required' => false)),
      'is_salesrep'      => new sfValidatorBoolean(array('required' => false)),
      'is_admin_updated' => new sfValidatorBoolean(array('required' => false)),
      'is_email_active'  => new sfValidatorBoolean(array('required' => false)),
      'rt_valid'         => new sfValidatorBoolean(array('required' => false)),
      'rt_updated_at'    => new sfValidatorDateTime(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('user[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'User';
  }

}
